Repository navigation
Keep LLM-provided value on qualitative rows - #611
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the change preserving non-null qualitative values and using summaries only as a null-value fallback.
No open issues 🎉
What changed in this PR
This PR preserves LLM-provided values for qualitative features when COMPASS saves ordinance results, using the summary only when the value is null.
Changes:
- Keep non-null qualitative values, including structured lists, rather than overwriting them with summaries.
- Add regression coverage for list preservation and the null-value fallback.
| File | Description |
|---|---|
tests/python/unit/utilities/test_utilities_finalize.py |
Tests preservation of structured values and fallback to summary for null values. |
compass/utilities/finalize.py |
Restricts summary-to-value copying to null qualitative values and updates the docstring. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #611 +/- ##
=======================================
Coverage 76.63% 76.64%
=======================================
Files 85 85
Lines 9866 9870 +4
Branches 1086 1086
=======================================
+ Hits 7561 7565 +4
Misses 2097 2097
Partials 208 208
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
This seems harmless enough. I think the reason that this hasn't been an issue before is that we have been defining qualitative features as those that only have a summary (i.e. explicitly no value output). In other words, I was routing the list-output features like "prohibited districts", etc. to the "quantitative" output.
This is not a bulletproof system though, so the check you added in this PR increases the robustness of the code. Thanks!
…fore fill Only fill value from summary when both value is empty and summary is not blank. This prevents garbage data when both are blank, and ensures LLM-provided values (such as lists or structured text) are preserved.
Add tests for: - Both value and summary blank (should not fill) - Value blank with real summary (should fill) - Value real with blank summary (should not fill) - Whitespace variations (tabs, newlines, mixed) - Falsy non-string values (0, False, []) - Numeric summary values (should not be treated as valid)
0ea23ec to
ff3f0b6
Compare
Only fill value from summary when the LLM left it null, so qualitative features that return structured values (e.g. a list of franchise grantees or permit types) are no longer overwritten by summary.
Summary is currently redundant with value for qualitative features, so this is a natural transition to eventually drop the summary in favor of the combination: value + ord_text + explanation.